{% extends "FOSUserBundle::layout.html.twig" %}

{% block head %}
{{parent()}}
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
	<meta http-equiv="refresh" content="1; url={{path('cadss_test_homepage')}}" />
	<script type="text/javascript">
            window.location.href = "{{path('cadss_test_homepage')}}"
    </script>
{% endif %}
{% endblock head %}

{% block fos_user_content %}
		{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}	
			<div class="toast">	{{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }}
			<img src="{{ asset('img/close.png') }}" witdh="16" height="16" onclick="this.parentNode.style.display='none'"/></div>
		{% elseif  error%}
			<div class="toast">{{ error|trans({}, 'FOSUserBundle') }}<img src="{{ asset('img/close.png') }}" witdh="16" height="16" onclick="this.parentNode.style.display='none'"/></div>
        {% endif %}
		
		<div id="dragme" class="login unselectable">	
			<form action="{{ path("fos_user_security_check") }}" method="post">
				<input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
				<table>
				<tr>
					<td><label for="username">{{ 'security.login.username'|trans({}, 'FOSUserBundle') }}</label></td>
					<td><input type="text" id="username" name="_username" value="{{ last_username }}" required="required" /></td>
				</tr>
				<tr>
					<td><label for="password">{{ 'security.login.password'|trans({}, 'FOSUserBundle') }}</label></td>
					<td><input type="password" id="password" name="_password" required="required" /></td>
				</tr>
				<tr>
					<td colspan="2"><input type="checkbox" id="remember_me" name="_remember_me" value="on" />
					<label for="remember_me">{{ 'security.login.remember_me'|trans({}, 'FOSUserBundle') }}</label></td>
				</tr>
				<td colspan="2">
				<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans({}, 'FOSUserBundle') }}"/></td> </tr>
				<tr><td colspan="2" id="register"><a href="{{ path('fos_user_registration_register') }}">{{ 'layout.register'|trans({}, 'FOSUserBundle')|lower }}</a></td></tr>
				</table>
			</form>
		</div>
	
{% endblock fos_user_content %}


